<template>
	<view>
		<button type="default" @click="bclick1">轻提示</button>
		<button type="default" @click="bclick2">轻提示-不要图标</button>

		<button style="margin-top: 60rpx;" type="default" @click="bclick3">显示 loading</button>
		<button type="default" @click="bclick4">关闭 loading</button>

		<button style="margin-top: 60rpx;" type="default" @click="bclick5">显示模态弹窗</button>
		<button type="default" @click="bclick6">显示模态弹窗，去掉取消按钮</button>

		<view style="margin-top: 60rpx;">选择了{{ num }}</view>
		<button type="default" @click="bclickz">弹出底部</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			num: 0
		};
	},
	methods: {
		bclick1() {
			uni.showToast({
				title: '点击成功',
				duration: 2000
			});
		},
		bclick2() {
			uni.showToast({
				title: '点击成功',
				icon: 'none',
				duration: 2000
			});
		},
		bclick3() {
			uni.showLoading({
				title: '加载中'
			});
		},
		bclick4() {
			uni.hideLoading();
		},
		bclick5() {
			uni.showModal({
				title: '提示',
				content: '您确定要收藏吗？',
				success: function(res) {
					if (res.confirm) {
						console.log('用户点击确定');
					} else if (res.cancel) {
						console.log('用户点击取消');
					}
				}
			});
		},
		bclick6() {
			uni.showModal({
				title: '提示',
				showCancel:false,
				content: '您确定要拨打电话吗？',
				success: function(res) {
					if (res.confirm) {
						console.log('用户点击确定');
					} else if (res.cancel) {
						console.log('用户点击取消');
					}
				}
			});
		},
		bclickz() {
			let _this = this;
			uni.showActionSheet({
				itemList: ['A', 'B', 'C'],
				success: function(res) {
					_this.num = res.tapIndex + 1;
				},
				fail: function(res) {
					console.log(res.errMsg);
				}
			});
		}
	}
};
</script>

<style scoped></style>
